package generic.gui.util;

import java.awt.BorderLayout;
import java.awt.event.KeyListener;

@SuppressWarnings("serial")
public class JTextLabelForm extends JPanelForm {
	
	private JTextFieldForm text;
	private JLabelForm label;
	
	public JTextLabelForm(String label) {
		setLayout(new BorderLayout());
		
		getLabel().setText(" " +label);
		add(getLabel(), BorderLayout.NORTH);
		add(getText(), BorderLayout.SOUTH);
	}
	
	public JTextFieldForm getText() {
		if (text == null) {
			text = new JTextFieldForm();
		}
		return text;
	}

	public void setText(JTextFieldForm text) {
		this.text = text;
	}

	public JLabelForm getLabel() {
		if (label == null) {
			label = new JLabelForm();
		}
		return label;
	}

	public void setLabel(JLabelForm label) {
		this.label = label;
	}
	public void setBounds(int x,int y,int width,int height) {
		super.setBounds(x, y, width, height);
	}
	public void setColumns(int arg0) {
		getText().setColumns(arg0);
	}
	
	public void addKeyListener(KeyListener l) {
		getText().addKeyListener(l);
	}
	@Override
	public void grabFocus() {
		getText().grabFocus();
	}
}
